package com.szq.day39.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.szq.day39.Exception.BusinessException;
import com.szq.day39.biz.UsersBiz;
import com.szq.day39.entity.Users;

@Controller
@RequestMapping("/users")
public class UsersController {
	@Resource
	private UsersBiz biz;
	
	@RequestMapping("/login")
	public String login(Users user,HttpSession session) throws BusinessException{
		Users users=biz.login(user);
		if(users==null){
			return "/login";
		}else{
			session.setAttribute("currentUser", users);
			return "redirect:/blog/list";
		}
	}
	
}
